﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RayDen.Library.Components.SystemComponents;
using RayDen.Library.Data.Xml;
using RayDen.Library.Entity.Frames;

namespace RayDen.SceneLab.Controllers.Frame
{
    public class FrameController
    {
        private FrameDescription frame;
        public void OpenFrame(string frameName)
        {
            using (var frameFile = new FileStream(frameName, FileMode.Open, FileAccess.Read))
            {
                using (var reader = new StreamReader(frameFile))
                    frame = (FrameDescription)SerializationService.Deserialize(reader.ReadToEnd(), typeof(FrameDescription));
            }
            frame.FrameName = Path.GetFileNameWithoutExtension(frameName);
            Tracer.TraceLine("Frame [[{0}]] loaded", frame.FrameName);
        }
    }
}
